﻿using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Songhay.Silverlight.BiggestBox.AdditionalSamplesPart.ViewModels
{
    using Songhay.Mvvm.ViewModels;

    /// <summary>
    /// View Model for Data Visualization
    /// </summary>
    /// <remarks>
    /// For more, see “Charting in Silverlight”
    /// by Mahesh Chand [http://www.c-sharpcorner.com/uploadfile/mahesh/charting-in-silverlight/]
    /// </remarks>
    public class DataVisualizationViewModel : ViewModelBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="DataVisualizationViewModel"/> class.
        /// </summary>
        /// <remarks>
        /// For details, see
        /// “How to: Implement Property Change Notification”
        /// http://msdn.microsoft.com/en-us/library/ms743695.aspx
        /// A sample <c>set</c> block:
        /// <code>
        /// set
        /// {
        /// _myProperty = value;
        /// OnPropertyChanged("MyProperty");
        /// }
        /// </code>
        /// </remarks>
        public DataVisualizationViewModel()
        {
            var array = new KeyValuePair<string, int>[]
            {
                new KeyValuePair<string, int>("Project Manager", 12),
                new KeyValuePair<string, int>("CEO", 25),
                new KeyValuePair<string, int>("Software Engg.", 5),
                new KeyValuePair<string, int>("Team Leader", 6),
                new KeyValuePair<string, int>("Project Leader", 10),
                new KeyValuePair<string, int>("Developer", 4)
            };
            this.ChartSeries = new ObservableCollection<KeyValuePair<string,int>>(array);
        }

        /// <summary>
        /// Gets or sets the chart series.
        /// </summary>
        /// <value>The chart series.</value>
        public ObservableCollection<KeyValuePair<string, int>> ChartSeries
        {
            get { return this._chartSeries; }
            set
            {
                this._chartSeries = value;
                base.RaisePropertyChanged("ChartSeries");
            }
        }

        ObservableCollection<KeyValuePair<string, int>> _chartSeries;
    }
}
